package gsw.demo.mvvm;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.widget.ListView;

import java.util.ArrayList;
import java.util.List;


/**
 * MVVM中列表的示例
 */
public class ActivityList extends AppCompatActivity {

    ListView list;
    List<User> data = new ArrayList<>();

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_list);
        list = (ListView) findViewById(R.id.listView);
        data.add(new User("Tom01", "123456", "https://goss1.vcg.com/creative/vcg/800/new/VCG41N104285826.jpg"));
        data.add(new User("Tom02", "123456", "https://goss1.vcg.com/creative/vcg/800/new/VCG41N104285826.jpg"));
        data.add(new User("Tom03", "123456", "https://goss1.vcg.com/creative/vcg/800/new/VCG41N104285826.jpg"));
        data.add(new User("Tom04", "123456", "https://goss1.vcg.com/creative/vcg/800/new/VCG41N104285826.jpg"));
        list.setAdapter(new CommAdapter<User>(this, getLayoutInflater(), R.layout.item, BR.user, data));
    }
}
